import request from '@/utils/request'

/**
 * 根据id查询企业
 *  /company/{id}  GET
 * **/
export function getCompanyInfo(id) {
  return request({
    url: `/company/${id}`
  })
}

/**
 * 获取所有角色列表
 *   /sys/role  GET
 * **/
export function getRoleList(params) {
  return request({
    url: `/sys/role`,
    params
  })
}

/**
 * 根据id删除角色
 *   /sys/role/{id}  DELETE
 * **/
export function delRole(id) {
  return request({
    url: `/sys/role/${id}`,
    method: 'delete'
  })
}

/**
 * 添加角色
 *   /sys/role   POST
 * **/
export function addRole(data) {
  return request({
    url: '/sys/role',
    method: 'post',
    data
  })
}

/**
 * 根据ID获取角色详情
 *    /sys/role/{id}   GET
 * **/
export function getRoleDetail(id) {
  return request({
    url: `/sys/role/${id}`
  })
}

/**
 * 根据ID更新角色
 *    /sys/role/{id}   PUT
 * **/
export function editRole(data) {
  return request({
    url: `/sys/role/${data.id}`,
    method: 'put',
    data
  })
}

export function assignPerm(data) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
